//处理模型
const {
    successModel,
    failModel
} = require('../model/responseModel')

const {
    getRecommend,
} = require('../controller/recommend')


//获取商品相关的路由
const handleRecommendRoute = (req, res) => {
    //定义处理路由的逻辑
    const method = req.method;
    switch (method) {
        case 'GET': {
            if (req.path === '/recommend') {
                return getRecommend(req.query).then(data => {
                    if (data) {
                        return new successModel(data)
                    } else {
                        return new failModel('获取推荐数据失败')
                    }
                })
            }else{
                return
            }

        };
    default: {
        return;
    }
    }

}

module.exports = handleRecommendRoute